package com.warm.mini.wework.service.invoke.handler;

import com.warm.mini.wework.config.WeworkConfigProperties;
import com.warm.mini.wework.constant.WeworkModelEnum;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description 回调消息处理
 * @Author warmchuang
 * @Date 2022/2/9 16:13
 */
@Slf4j
public abstract class AbstractMsgHandler {
    public abstract String resource();

    public void handle(String xmlMsg, WeworkConfigProperties config){
        if(WeworkModelEnum.CONTACT.getValue().equals(config.getModel())){
            changeContactHandle(xmlMsg, config);
        } else if(WeworkModelEnum.EXTERNAL_CONTACT.getValue().equals(config.getModel())){
            changeExternalContactHandle(xmlMsg, config);
        }
    }

    public abstract void changeContactHandle(String xmlMsg, WeworkConfigProperties config);

    public abstract void changeExternalContactHandle(String xmlMsg, WeworkConfigProperties config);
}
